<!DOCTYPE html>
<html style="height:100%">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css">
  <link rel="stylesheet" href="https://static.pingendo.com/bootstrap/bootstrap-4.1.3.css">
</head>

<body style="height:100%">
  <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
    <div class="container"> <a class="navbar-brand" href="index.html">
        <i class="fa d-inline fa-lg fa-circle-o"></i>
        <b>SEHP资源共享平台</b>
      </a> <button class="navbar-toggler navbar-toggler-right border-0" type="button" data-toggle="collapse" data-target="#navbar11">
        <span class="navbar-toggler-icon"></span>
      </button>
      <div class="collapse navbar-collapse" id="navbar11">
          <ul class="navbar-nav mr-auto">
            <li class="nav-item"> <a class="nav-link" href="public.sehp">公共资源</a> </li>
            <li class="nav-item"> <a class="nav-link" href="private.sehp">我的资源</a> </li>
          </ul>
          <ul class="navbar-nav ml-auto" id="mynavbar">
            <li class="nav-item"> <a class="nav-link" href="myupload.html">我的上传</a> </li>
            <li class="nav-item"> <a class="nav-link" href="info.sehp">我的信息</a> </li>
          </ul> <a class="btn btn-primary navbar-btn ml-md-2" onclick="javascript:$('#myModal').modal()">上传文件</a>
        </div>
    </div>
  </nav>
  <div class="py-5 text-center" style="background-image: linear-gradient(to left bottom, rgba(189, 195, 199, .75), rgba(44, 62, 80, .75)); background-size: 100%;">
    <div class="container" style="height:100%">
      <div class="row">
        <div class="mx-auto col-md-6">
          <h1>上传文件</h1>
          <form class="form-inline d-flex justify-content-center">
            <div class="input-group"> <input type="email" class="form-control" placeholder="请选择文件" id="form1">
              <div class="input-group-append"> <button class="btn btn-primary" type="button">点击上传</button> </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
  <!-- 模态框 -->
  <div class="modal fade" id="myModal">
      <div class="modal-dialog">
        <div class="modal-content">
     
          <!-- 模态框头部 -->
          <div class="modal-header">
            <h4 class="modal-title">资源上传</h4>
            <button type="button" class="close" data-dismiss="modal">&times;</button>
          </div>
     
          <!-- 模态框主体 -->
          <div class="modal-body">
            <iframe id="upm" src="http://127.0.0.1:8199/upload/show" width="100%" scrolling="no" frameborder="no"></iframe>
          </div>
     
          <!-- 模态框底部 -->
          <div class="modal-footer">
            <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
          </div>
     
        </div>
      </div>
    </div>
  <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.slim.min.js"></script>
  <script src="https://cdn.bootcss.com/popper.js/1.14.6/popper.js"></script>
  <script src="js/bootstrap.min.js"></script>
  <script>
      ShowWelcome()
      function setCookie(name,value) 
      { 
        var Days = 30; 
        var exp = new Date(); 
        exp.setTime(exp.getTime() + Days*24*60*60*1000); 
        document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString(); 
      } 
      function getCookie(name) 
      { 
          var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
          if(arr=document.cookie.match(reg))
              return unescape(arr[2]); 
          else 
              return null; 
      }
      function ShowWelcome()
      {
        if(getCookie("UserName") != null)
        {
          var elem_li = document.createElement('li'); // 生成一个 li元素
          elem_li.innerHTML = '<li class="nav-item"> <a class="nav-link" href="#" id="Welcome">欢迎您,'+getCookie("UserName")+'</a> </li>'
          document.getElementById("mynavbar").appendChild(elem_li)
          var ifr = document.getElementById("upm");
          ifr.src="http://127.0.0.1:8199/upload/show?UserName="+getCookie("UserName");
          console.log(ifr.src)
        }
      }
    </script>
</body>

</html>